const mongoose = require('mongoose')

const Schema = mongoose.Schema

mongoose.connect('mongodb://localhost/vue-blog')

const uploadSchema = new Schema({ 
  name: {
    type: String,
    required:true
  },
  imgurl: {
    type: String,
    default:'https://www.ipicbed.com/images/2021/12/23/avater01.th.jpg'
  },
  size: {
    type: 'String',
    required:true
  },
  created_time: {
    type: Date,
    default: Date.now
  },
  last_modified_time: {
    type: Date,
    default: Date.now
  },
})

module.exports = mongoose.model('Upload', uploadSchema)